import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
 // 状态存储
  state: {
    isshop:sessionStorage.getItem('ishop'),//用于标识用户购买会员是否已支付
    islogin:sessionStorage.getItem('islogin'),
    uid:sessionStorage.getItem('uid'),
    uphone:sessionStorage.getItem('uphone'), //用于标识用户是否已经登录
    ismember:sessionStorage.getItem('ismember'),
    mphone:sessionStorage.getItem('mphone') //用于标识用户是否为会员
  },
  mutations: {
    loginok(state,newname){
      //向sessionStorage中存储islogin与name
      sessionStorage.setItem('uid',newname)
    },
    loginis(state,newname){
      sessionStorage.setItem('islogin',true)
      sessionStorage.setItem('uphone',newname)
    },
    loginiy(state,newname){
      sessionStorage.setItem('ismember',true)
      sessionStorage.setItem('mphone',newname)
    },
    vipshop(state,newname){
      sessionStorage.setItem('isshop',newname)
    }
  },
  actions: {
  },
  modules: {
  }
})
